<?php
// $Id: homebox.tpl.php,v 1.1.4.25 2010/10/07 08:15:53 drumm Exp $

/**
 * @file
 * homebox.tpl.php
 * Default layout for homebox.
 */
?>
<?php global $user; ?>

<div id="homebox" class="<?php print $classes ?>">
  <div id="homebox-configure">
    <?php print t("Configure:");?>
    <a href="#" onclick="homebox_display_control(this)"><?php print t('Off');?></a>
    <br/>
    <a href="<?php print url("admin/build/homebox/layout/$page->name/window=true");?>" class="modalframe-example-child modalframe-example-size[900,800] onSubmitCallbackExample" url_refresh="<?php print $page->name;?>"><?php print t('Page Configure');?></a>
  </div>
  <?php if ($user->uid): ?>
  <div id="homebox-buttons">
      <?php if (!empty($add_links)): ?>
    <a href="javascript:void(0)" id="homebox-add-link" ><?php print t('Add a block') ?></a>
      <?php endif; ?>
      <?php print $save_form; ?>
  </div>
  <?php endif; ?>

  <?php if (!empty($add_links)): ?>
  <div id="homebox-add"><?php print $add_links; ?></div>
  <?php endif; ?>

  <div class="homebox-maximized"></div>
  <?php for ($i = 1; $i <= count($regions); $i++): ?>
  <div class="homebox-column-wrapper homebox-column-wrapper-<?php print $i; ?>"<?php print count($page->settings['widths']) ? ' style="width: ' . $page->settings['widths'][$i] . '%;"' : ''; ?>>
    <div class="homebox-column" id="homebox-column-<?php print $i; ?>">
        <?php foreach ($regions[$i] as $key => $weight): ?>
          <?php foreach ($weight as $block): ?>
            <?php if ($block->content): ?>
              <?php print theme('homebox_block', $block, $page); ?>
            <?php endif; ?>
          <?php endforeach; ?>
        <?php endforeach; ?>
    </div>
  </div>
  <?php endfor; ?>
  <div class="clear-block"></div>
</div>
<?php if(!user_access('administer homebox')):?>
<script>
  $('div[id^=homebox-block-] div h3').remove();
  $('#homebox-configure').remove();
  $('#homebox-buttons').remove();
</script>
<?php endif?>
<script>
  function homebox_display_control(self){
    var text = $(self).text();
    var config = {
      'On': {'text': 'Off', 'display': 'block'},
      'Off': {'text': 'On', 'display': 'none'}
    };
    $(self).text(config[text]['text']);
    $('div[id^=homebox-block-] div h3').attr('style','display: '+config[text]['display']);
  }

  function homebox_page_control(self){
    
  }
</script>